<template>
	<view>
		
		<view class="message" v-for="(item,index) in message" :key="index">
			<view class="msg_logo">{{item.sendUserId}}</view>
			<view class="msg_message" @click="detailsMsg()">{{item.msg}}</view>
			<view class="msg_date">{{item.createTime}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user_id:'',
				message:[{
					sendUserId:'',
					msg:'',
					createTime:''
				}]
			}
		},
		created() {	
			this.showMessage();
		},
		methods: {
		detailsMsg(){
				uni.navigateTo({
				    url: '../detailsMsg/detailsMsg'
				});
			},
		showMessage(){
			const than = this;
		 uni.getStorage({
			    key: 'id',
			    success: function (res) {
					than.user_id = res.data;
			        
			    }
			});
			
			than.$server('/u/getUnReadMsgList', {
							'acceptUserId':this.user_id
						},'POST').then(res => {
			if(res.status === 200){
				console.log(than)
			than.message = res.data;
			// than.message.msg = res.data.msg;
			// than.message.sendUserId = res.data.sendUserId;
				console.log(than.message)
				
			}
			
			})
			
		}
	}
	}
</script>

<style>
.message{
	width: auto;
	height: 60px;
	border: #808080 1px solid;
	display: flex;
	
}
.msg_logo{
	margin-top: 20rpx;
	margin-left: 20rpx;
	width: 80rpx;
	height: 80rpx;
	border: #808080 1px solid;
	text-align: center;
	
}
.msg_message{
	margin-top: 20rpx;
	margin-left: 20rpx;
	width: 500rpx;
	height: 80rpx;
	border: #808080 1px solid;
	text-align: center;
	
}
.msg_date{
	margin-top: 20rpx;
	margin-left: 20rpx;
	width: 80rpx;
	height: 80rpx;
	border: #808080 1px solid;
	
}
</style>
